<template>
	<view>
		<!-- <map name="map"></map> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				infoData: {},
				showState: false,
				id: ''
			}
		},
		onLoad(option) {
			this.infoData = JSON.parse(decodeURIComponent(option.infoData))
			this.id = this.infoData.id
			this.showState = true
		},
		mounted() {
			this.toMap(this.infoData)
		},
		onShow(option) {
			console.log(this.id)
			if (this.showState === false) {
				uni.redirectTo({
					url: '/pages/noticeDetail/noticeDetail?id=' + this.id
				})
			}
		},
		methods: {
			toMap (info) {
				this.showState = false
				wx.openLocation({
					type: 'gcj02',
					latitude: info.latitude,
					longitude: info.longitude,
					name: info.name,
					address: info.address,
					success: (res) => {
						console.log(res)
					}
				})
			}
		}
	}
</script>

<style>

</style>
